package com.minivision.fdiot.service;

import java.util.List;

import com.minivision.fdiot.entity.FaceSet;
import com.minivision.fdiot.exception.FacePlatException;
import com.minivision.fdiot.rest.param.faceset.SetCreateParam;
import com.minivision.fdiot.rest.param.faceset.SetModifyParam;
import com.minivision.fdiot.rest.result.faceset.AddFaceResult;
import com.minivision.fdiot.rest.result.faceset.RemoveFaceResult;
import com.minivision.fdiot.rest.result.faceset.SetCreateResult;
import com.minivision.fdiot.rest.result.faceset.SetDeleteResult;
import com.minivision.fdiot.rest.result.faceset.SetDetailResult;
import com.minivision.fdiot.rest.result.faceset.SetListResult;
import com.minivision.fdiot.rest.result.faceset.SetMergeResult;
import com.minivision.fdiot.rest.result.faceset.SetModifyResult;

public interface FaceSetService {

	/**
	 * Create a faceset
	 * 
	 * @param owner
	 *            Use appKey
	 * @param capacity 
	 * @return The facesetToken
	 */
	public SetCreateResult create(SetCreateParam param) throws FacePlatException;
	
	/**
	 * Add faces to faceset
	 * 
	 * @param setToken
	 *            The dest faceset
	 * @param faceTokens
	 *            The faces to be added
	 * @return Operation result
	 * @throws FacePlatException
	 */
	public AddFaceResult addFace(boolean needPush2Device, String setToken,String appKey, String... faceTokens) throws FacePlatException;

	/**
	 * Delete a faceset
	 * 
	 * @param owner
	 *            Use appKey
	 * @param force
	 *            Delete or not if the faceset is not empty
	 * @return The facesetToken
	 */
	public SetDeleteResult delete(String setToken, boolean force,String appKey,boolean needPush2Device) throws FacePlatException;

	/**
	 * remove faces to faceset
	 * @param setToken
	 * @param faceTokens
	 * @return
	 * @throws FacePlatException
	 */
	public RemoveFaceResult removeFace(boolean needPush2Device, String setToken,String appKey, String... faceTokens) throws FacePlatException;
	
	/**
	 * modify faceset
	 * @param setToken
	 * @param displayName
	 * @return
	 * @throws FacePlatException
	 */
	public SetModifyResult modify(SetModifyParam param) throws FacePlatException;
	
	//public SetModifyResult modify(String setToken, String displayName) throws FacePlatException;

	/**
	 * get faceset detail message
	 * @param setToken
	 * @return SetDetailResult with filled property "faces"
	 * @throws FacePlatException
	 */
	public SetDetailResult getFaceSetDetail(String setToken, long offset, long count,String appKey) throws FacePlatException;
	
	
	/**
	 * @param offset
	 * @param count
	 * @return
	 * @throws FacePlatException
	 */
	public SetListResult getFaceSetList(int offset, int count,String appKey) throws FacePlatException;

	/**
	 * merge faceset1 and faceset2
	 * @param setToken1
	 * @param setToken2
	 * @return
	 * @throws FacePlatException
	 */
	public SetMergeResult mergeSet(String appKey, String setToken1, String setToken2,boolean needPush2Device) throws FacePlatException;
	
	boolean exists(String setToken);
	
	List<FaceSet> findByAppKey(String appKey);

}
